home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / Aidan's Class Libraries / Source / Headers / CLList.h < prev    next >
Encoding:
Text File  |  1997-05-24  |  1.0 KB  |  50 lines  |  [TEXT/CWIE]

  1. //Copyright (c) 1997 Aidan Cully
  2. //All rights reserved
  3.  
  4. #ifndef __LISTS_H
  5. #define __LISTS_H
  6.  
  7. #include <Types.h>
  8.  
  9. //class TList
  10. //    uses:
  11. //        Used to keep track of a lot of data elements
  12. //    theory:
  13. //        Uses a "Present element" which says which element I'm performing operations on now.
  14. //        This is fairly clumsy, I hope to redo it at some point, but a lot of code relies on it
  15. //        now, and I don't enjoy major rewrites (no matter how much it looks like I do :-).
  16. template <class T>
  17. class TData
  18. {
  19. public:
  20.     TData( T );
  21.     TData *mPrev, *mNext;
  22.     T mData;
  23.     Boolean AddNext( T );
  24.     Boolean AddPrev( T );
  25. };
  26.  
  27. template <class T>
  28. class TList
  29. {
  30. protected:
  31.     TData<T> *mNode;
  32. public:
  33.     TList();
  34.     virtual ~TList();
  35.     virtual Boolean MoveFirst();
  36.     virtual Boolean MoveLast();
  37.     virtual Boolean MoveNext();
  38.     virtual Boolean MovePrev();
  39.     virtual Boolean GetData( T& );
  40.     virtual Boolean SetData( T );
  41.     virtual Boolean GoToElem( SInt16 );
  42.     virtual SInt16 FindIndex( T );
  43.     virtual Boolean AddPrev( T );
  44.     virtual Boolean AddNext( T );
  45.     virtual Boolean Remove();
  46. };
  47.  
  48. #include "Lists.cpp"
  49.  
  50. #endif